<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>新增题目</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="../../component/layui/css/layui.css" />
        <link rel="stylesheet" href="../../component/pear/css/pear.css" />
        <script src="../../component/layui/layui.js"></script>
        <script src="../../component/pear/pear.js"></script>
    </head>
<body>
    <div class="layui-layer-content">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">分类</label>
                        <div class="layui-input-inline">
                        <input type="text" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" style="margin: 0 40px;">
                        <table class="layui-table" id="cols-table"></table>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
    <div class="layui-input-block" style="margin-top: 20px; margin-right: 20px; float: right;">
        <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">保存</button>
        <button type="reset" class="layui-btn layui-btn-primary">取消</button>
    </div>
    </div>
</div>
  
<script>
    layui.use(['table'], function() {
        var table = layui.table;

        table.render({
            elem: '#cols-table',
            url: '../../admin/data/ques.json',
            height: '350px',
            cols: [[
                { field: 'catalog', title: '题目类型' },
                { field: 'question', title: '题干描述' },
                { field: 'choise', title: '选项' },
                { field: 'default', title: '默认值' },
                { field: 'required', title: '是否必填' },
                { fixed: 'right', title: '操作' }
            ]]
        });

        table.on('toolbar(ques-table)', function(obj) {
            if (obj.event === 'addNewData') {
                layer.open({
                    title: '新增题目',
                    type: 2,
                    area: ['80%', '80%'],
                    content: '/view/ques/addQues.html'
                });
            }
        });
    })
</script>

</body>
</html>